// js 单线程  event loop 异步多任务，不支持 sleep
// setTimeout + callback
let fun = () => console.log('time out')

let sleep = function(func, time) {
  setTimeout(() => {
    func();
  }, time)
}

sleep(fun, 2000)